#pragma once

#include "cybertron/bridge/CybertronBridgeSyncTaskBase.hpp"
#include "cybertron/core/UtilProcess.hpp"
#include "cybertron/core/logServer.hpp"

#include "cybertron/node/NodeHotAreaManager.hpp"

CYBERTRON_BEGIN

class TaskControlModuleRun : public CybertronBridgeSyncTaskBase{

public:
    TaskControlModuleRun(std::string hostVehicleId);
	~TaskControlModuleRun();

	bool onStart() override;
	uint16_t onFrame(uint64_t frame) override;
	void onEnd() override;

    void bridgeOnTimer(NodeHotAreaManager &mgr, int ms, int msModNs);
	cybertron::ProcessHandle & getProcessHandle() {
		return mProcessHandle;
	}
private:
    std::string mModuleFile = "";
	cybertron::ProcessHandle mProcessHandle;
	void runSystemCmd();
	bool runModule();
    bool unzipFile(const std::string& urlFile, const std::string& dir);

    std::string mUnpackDir;
	
	bool mbRunExeIsWindows;
	bool mIsPython;
	
};

CYBERTRON_END
